<template>
	<view class="withdraw-password">
		<view class="withdraw-password-tit">请再输入一次</view>
		<validcode :maxlength="6" :isPwd="true" :focus="false" @finish="getCodeNumberAgain" class="enter-code-box"></validcode>
		<view class="withdraw-password-submit"><button type="primary" :disabled="isSubmit?false:true" @click="submit"  hover-class="">确定</button></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				password: '',
				again: '',
				isSubmit: false
			};
		},
		onLoad(opstions) {
			this.password = opstions.password
		},
		methods: {
			getCodeNumberAgain(e){
				this.again = e
				this.isSubmit = true
			},
			submit(){
				if(this.again!=this.password){
					uni.showToast({
						icon: 'none',
						title: '两次输入的密码不一致，请重新输入',
						duration: 1500
					})
				}else{
					this.$api.UpPrivateKey({privat_key: this.again}).then(res => {
						uni.showToast({
							icon: 'none',
							title: '设置成功',
							duration: 1500
						})
						setTimeout(() => {
							uni.navigateBack({
								delta: 3
							})
						},1500)
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.withdraw-password{
		padding: 130rpx 40rpx;
		.withdraw-password-tit{
			text-align: center;
			margin-bottom: 100rpx;
		}
		.withdraw-password-submit{
			text-align: center;
			margin-top: 130rpx;
			button{
				font-size: 36rpx;
				background-color: #2073F5;
				height: 100rpx;
				line-height: 100rpx;
				border-radius: 100rpx;
			}
		}
	}
</style>